<template>
  <div class="house">
    <div class="title-house">
      <h2>深圳精选房推荐</h2>
      <div class="subtitle">
        <span class="txt">为您精选好房，帮您找到温馨的家</span>
        <span class="more pointer"  @click="topage('/filterHouse',null)">更多房推荐</span>
      </div>
    </div>
    <div class="list">
      <div
        class="jjs_bd_log translateY"
        @click="topage('/houseDetail',item.id)"
        v-for="(item, index) in houseList"
        :key="index"
      >
        <div class="img">
          <img :src="item.house_banner[0]" alt="" />
        </div>
        <div class="text">
          <div class="name">
            {{ item.house_title }}
          </div>
          <p>
            <em class="attr mr10"> {{ item.pro_type }} </em>
            <em class="attr">户型{{ item.sale_area }}㎡</em>
            <em class="price">
              <em class="unit"></em
              >{{ item.refer_price ? item.refer_price : "待定"
              }}<em class="unit">元/m²</em>
            </em>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { defineComponent, reactive } from "vue";
import { useRouter } from "vue-router";
import { useStore } from "vuex";
export default defineComponent({
  props: {
    houseList: Array,
  },
  setup(props) {
    const router = useRouter();
    const topage = (route, id) => {
      router.push({ path: route, query: { id } });
    };
    return {
      topage,
    };
  },
});
</script>


<style lang="scss">
.house {
  width: 1200px;
  margin: 0 auto;
  margin-top: 65px;
  .title-house {
    min-height: 38px;
    h2 {
      display: inline-block;
      font-size: 26px;
      line-height: 36px;
      color: #000000;
      font-weight: 600;
    }
    .subtitle {
      display: flex;
      justify-content: space-between;
      width: 100%;
      .txt {
        font-size: 14px;
        line-height: 24px;
        color: #999;
      }
      .more {
        float: right;
        font-size: 14px;
        line-height: 24px;
        color: #666666;
        &:hover {
          color: #e03236;
        }
      }
    }
  }
  .list {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    .jjs_bd_log {
      &:nth-of-type(4n) {
        margin-right: 0;
      }
      margin-bottom: 30px;
      width: 282px;
      margin-right: 20px;
      background: #fff;
      display: block;
      border-radius: 2px;
      .img {
        width: 282px;
        height: 212px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .text {
        padding: 0 20px;
        .name {
          margin: 20px 0;
          font-size: 16px;
          line-height: 22px;
          color: #333;
          overflow: hidden;
          font-weight: 600;
          display: flex;

          .price {
            font-size: 16px;
            color: #e03236;
            font-style: normal;
            float: right;
            font-weight: normal;
            .unit {
              font-size: 12px;
              font-style: normal;
              font-weight: normal;
            }
          }
        }
        p {
          padding: 10px 0;
          height: 25px;
          line-height: 25px;
          border-top: 1px solid #e6e6e6;
          box-sizing: content-box;
          margin-bottom: 10px;
          .attr {
            font-size: 12px;
            color: #999;
            font-style: normal;
            font-weight: normal;
          }
          .mr10 {
            margin-right: 10px;
          }
          .price {
            font-size: 16px;
            color: #e03236;
            font-style: normal;
            float: right;
            font-weight: normal;
            .unit {
              font-size: 12px;
              font-style: normal;
              font-weight: normal;
            }
          }
        }
      }
    }
  }
}
</style>